Fix WebGL texture atlas background cache churn on per-cell background colors - #6075
Open
s-celles wants to merge 2 commits into
Open
Fix WebGL texture atlas background cache churn on per-cell background colors#6075s-celles wants to merge 2 commits into
s-celles wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6074.
Problem
The WebGL glyph atlas is keyed on the full
bgvalue, colour bits included(
cacheMap.get(key, bg, fg, ext)). But_drawToCacheonly reads thebackground colour in three cases —
_getBackgroundColor(unlessallowTransparency),_getMinimumContrastColor(unlessminimumContrastRatiois 1), and the inverse swap. When none apply, every background colour rasterizes
a pixel-identical tile, yet each gets its own atlas entry. Content that varies
the background per cell (animated backgrounds, heatmaps, diffs, ANSI art) then
misses on every cell of every frame and grows the never-evicted atlas without
bound.
Fix
Introduce a
cacheKeyBgthat drops the background colour bits when they cannotchange the tile, keeping the
BgFlagsthat do (ITALIC,DIM,OVERLINE).INVERSE(read fromfg) stays in the key, since the inverse swap depends onthe colour. Same glyph over different background colours now reuses one atlas
entry.
Testing
CharAtlasUtils.test.ts— unit coverage forcacheKeyBg(colour dropped;rasterizing flags and the transparency / contrast / inverse exceptions kept).
WebglAtlasBackgroundChurn.test.ts— regression test that a per-cellbackground-colour sweep no longer multiplies atlas entries.
Assisted-by: AI